package grooverse.util;

class DeferredReferenceHandler {

    private references = []

    void add(Object object, String propertyName, Closure valueClosure) {
        references << { object[propertyName] = valueClosure.call() }
    }

    void resolve() {
        references.each{ it.call() }
        references.clear()
    }

}